export const getItem = (name:any) => {
    const data = localStorage.getItem(name)

    try {
        return JSON.parse(data as any)
    } catch(err) {
        return data
    }
}


export const setItem = (name:any) => {
    if(typeof name == 'object') {
       localStorage.setItem("user",JSON.stringify(name))
    } else {
        localStorage.setItem("user",name)
    }
}

export const removeItem = () => {
   let user =  localStorage.getItem("user")

   if(user){
       localStorage.removeItem(user)
   }
}